#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main()
{
	string a;
	while (cin >> a) {
		if (a.size() == 1 && a[0] == '#') {
			break;
		}
		int ans = 0;
		string b;
		cin >> b;
		while (a.find(b) != -1) {
			ans++;
			a = a.substr(a.find(b)+b.size());
		}
		cout << ans << endl;
	}
	return 0;
}